#include "ExpandTool.h"
#include "../../model/vo/DataVO.h"
#include "../../model/proxy/ItemProxy.h"

ExpandTool::ExpandTool(void)
{
	init();
}


ExpandTool::~ExpandTool(void)
{
}

bool ExpandTool::init()
{
	bool bRet = false;
	do
	{
		m_pDungeons = CCMenuItemImage::create(
			"group_dungeons_btn.png",
			"group_dungeons_btn.png",
			this,
			menu_selector(ExpandTool::menuCallback));
		m_pDungeons->setPosition(ccp(0, 0));
		m_pEquip = CCMenuItemImage::create(
			"group_equip_btn.png",
			"group_equip_btn.png",
			this,
			menu_selector(ExpandTool::menuCallback));
		m_pEquip->setPosition(ccp(160, 0));
		m_pProp = CCMenuItemImage::create(
			"group_prop_btn.png",
			"group_prop_btn.png",
			this,
			menu_selector(ExpandTool::menuCallback));
		m_pProp->setPosition(ccp(0, 48));
		m_pShop = CCMenuItemImage::create(
			"group_shop_btn.png",
			"group_shop_btn.png",
			this,
			menu_selector(ExpandTool::menuCallback));
		m_pShop->setPosition(ccp(160, 48));
		CCMenu* menus = CCMenu::create(m_pDungeons,m_pEquip,m_pProp,m_pShop,NULL);
		addChild(menus);

		bRet = true;

	}while(0);

	return bRet;
}

void ExpandTool::menuCallback(CCObject* pSender)
{
	if (pSender == m_pDungeons)
	{
		Framework::getSingletonPtr()->changeState("StartScene");
	} 
	else if(pSender == m_pEquip)
	{
	}
	else if(pSender == m_pProp)
	{
		Framework::getSingletonPtr()->changeState("DungeonsScene");
	}
	else if(pSender == m_pShop)
	{
	}
}

void ExpandTool::removeFromParent()
{
	if(this->getParent() != NULL)
		this->removeFromParentAndCleanup(true);
}
